/**********************************************************************************************************************
 *
 * Project:    mGameEngine
 * File:       orthogonalcamera.h
 * Author:     karooolek
 * Created on: 2009-04-03
 *
 **********************************************************************************************************************/

#ifndef ORTHOGONALCAMERA_H_
#define ORTHOGONALCAMERA_H_

#include "camera.h"
#include "glee.h"
#include <GL/glu.h>

namespace mGameEngine
{
namespace Graphics
{

/**
 * Orthogonal projection camera.
 */
class OrthogonalCamera : public Camera
{
protected:
    /**
     * Zoom.
     */
    float _zoom;

public:
    /**
     * Create orthogonal projetction camera with specified zoom.
     * @param zoom zoom value.
     * @param ratio aspect ratio.
     * @param autoRatio automatic aspect ratio calculation.
     * @param nearClip near clipping plane.
     * @param farClip far clipping plane.
     */
    OrthogonalCamera(float zoom = 1.0f,
                     float ratio = 1.0f, bool autoRatio = true,
                     float nearClip = 0.1f, float farClip = 100.f);

    /**
     * Destroy orthogonal projection camera.
     */
    virtual ~OrthogonalCamera();

    /**
     * Get zoom.
     * @return zoom.
     */
    float getZoom() const
    {
        return _zoom;
    }

    /**
     * Set zoom.
     * @param zoom zoom value.
     */
    void setZoom(float zoom)
    {
        _zoom = zoom;
    }

    /**
     * Test if sphere is visible in camera.
     * @param sphere sphere in camera coordinates.
     * @return true if sphere is all or partially visible, false otherwise
     */
    virtual bool isInCamera(const Sphere &sphere) const;

    /**
     * Calculate relative projected sphere size.
     * @param sphere sphere in camera coordinates.
     * @return projected sphere size relative to fov.
     */
    virtual float getProjectedSize(const Sphere &sphere) const;

    /**
     * Use orthogonal projection camera as active.
     */
    void use() const;
};

}
}

#endif // ORTHOGONALCAMERA_H_
